package com.rongcheng.applibs;

import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.rongcheng.applibs.talking_data.TalkingDataActivity;
import com.rongcheng.applibs.wave_water.WaveWaterActivity;
import com.tendcloud.tenddata.TCAgent;

public class MainActivity extends BaseActivity implements View.OnClickListener {
    private Button btn_wave_water, btn_talking_data;
private TextView tv_what;
    @Override
    protected int setLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
        btn_talking_data = (Button) findViewById(R.id.btn_talking_data);
        btn_wave_water = (Button) findViewById(R.id.btn_wave_water);
        tv_what= (TextView) findViewById(R.id.tv_what);


    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {
        btn_wave_water.setOnClickListener(this);
        btn_talking_data.setOnClickListener(this);
        try {
            tv_what.setOnClickListener(this);
        }catch (Exception e){
            Log.e(TAG,e.getMessage());
            TCAgent.onError(mContext,e);
        }

    }

    @Override
    public void onClick(View view) {
        if (view == btn_talking_data) {
            toTalkingDataActivity();

        } else if (view == btn_wave_water) {
            toWaveWaterActivity();
        }else if(view==tv_what) {
            toWhat();
        }

    }

    private void toWhat() {
        Log.e(TAG,"what's the wrong");
        TCAgent.onEvent(mContext,"干啥？","what's the wrong");
    }

    private void toWaveWaterActivity() {
        Intent intent = new Intent(mContext,WaveWaterActivity.class);
        intent.putExtra("FromWhere",TAG);
        startActivity(intent);
        TCAgent.onEvent(mContext,"水波纹","主页");
    }

    private void toTalkingDataActivity() {
        TCAgent.onEvent(mContext,"数据统计","主页");
        startActivity(new Intent(mContext,TalkingDataActivity.class));

    }
}
